#include"Map.hpp"
#include"Set.hpp"

using std::make_pair;

void test_for_map()
{
    my_space::map<int,int> mp;
    const int N=100;  
    for(int i=0;i<N;i++)
        mp.insert(make_pair(rand()%100+i,i));//随机插入100个元素 
    
    //mp.InOrder();
    my_space::map<int,int>::iterator it=mp.begin();
    while(it!=mp.end())
    {
        cout<<it->first<<":"<<it->second<<endl;
        ++it;
    }

    bool ret=mp.Is_Balance();//判断mp底层的红黑树是否平衡
    cout<<"mp is right?  "<<ret<<endl;
}   

void test_for_set()
{
    my_space::set<int> st;
    const int N=100;  
    for(int i=0;i<N;i++)
        st.insert(rand()%100+i);//随机插入100个元素 
    
    //st.InOrder();
    my_space::set<int>::iterator it=st.begin();
    while(it!=st.end())
    {
        cout<<*it<<endl;
        ++it;
    }

    bool ret=st.Is_Balance();//判断mp底层的红黑树是否平衡
    cout<<"st is right?  "<<ret<<endl;
}

int main()
{
    srand(time(0));

    //test_for_map();
    test_for_set();

    return 0;
}